function init() {
    var session = $('#session').val();
    if (session == '') {
        window.location.href = 'login';
    }
}

var myApp = angular.module('myApp', ["ngRoute"]);

myApp.controller('menuController', function ($scope, $http) {
    $scope.menu = []; // 初始化数据
    $http({url: "/getMenuList", method: "post"})
        .success(function (data) {
            for (var i in data) {
                var menu = data[i];
                $scope.menu.push(menu);
            }
        });
})
    .config(['$routeProvider', function ($routeProvider) {
        $routeProvider
            .when('/', {template: '<br/><br/><br/><br/>这里是首页'})
            .when('/menuManage', {templateUrl: 'menuManage.html', controller: 'menuManageController'})
            .when('/userManage', {templateUrl: 'userManage.html', controller: 'userManageController'})
            .when('/upload', {templateUrl: 'upload.html',controller: 'uploadController'})
            .when('/list', {templateUrl: 'list.html', controller: 'userController'})
            .when('/sendEmail', {templateUrl: 'email.html', controller: 'emailController'})
            .otherwise({redirectTo: '/', template: '未找到页面'});
    }])
;
